﻿using DeZhen.DataCollection.Model.Common;
using DeZhen.DataCollection.Model.Enums;
using SqlSugar;
using System;

namespace DeZhen.DataCollection.Model.Entities
{
    /// <summary>
    /// 采集任务表
    /// </summary>
    [SugarTable(TableName = "collection_task", TableDescription = "采集任务表")]
    public class CollectionTasks : BaseEntity
    {
        /// <summary>
        /// 采集实例表id，关联collection_instance表id字段
        /// </summary>
        [SugarColumn(ColumnName = "collection_instance_id", ColumnDescription = "采集实例表id，关联collection_instance表id字段")]
        public long CollectionInstanceId { get; set; }

        /// <summary>
        /// 数据源设置表id，关联datasource_settings表id字段
        /// </summary>
        [SugarColumn(ColumnName = "datasource_settings_id", ColumnDescription = "数据源设置表id，关联datasource_settings表id字段")]
        public long? DataSourceSettingsId { get; set; }

        /// <summary>
        /// 采集任务名称
        /// </summary>
        [SugarColumn(ColumnName = "task_name", ColumnDescription = "采集任务名称")]
        public string? TaskName { get; set; }

        /// <summary>
        /// 执行时间，单位：ms
        /// </summary>
        [SugarColumn(ColumnName = "excute_consume", ColumnDescription = "执行时间，单位：ms")]
        public int? ExcuteConsume { get; set; }

        /// <summary>
        /// 数据行数
        /// </summary>
        [SugarColumn(ColumnName = "affect_rows", ColumnDescription = "数据行数")]
        public int? AffectRows { get; set; }

        /// <summary>
        /// 执行状态：0未知，1成功，2失败
        /// </summary>
        [SugarColumn(ColumnName = "status", ColumnDescription = "执行状态：0未知，1成功，2失败")]
        public CollectionTypeEnum Status { get; set; }
    }
}
